/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.entity;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.lang.DateUtils;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.modules.xcxAdmin.entity.ZtAdmin;

/**
 * 收支明细
 * 
 * @author ThinkGem
 * @version 2018-04-22
 */
@Table(name = "zt_financial", alias = "a", columns = {
		@Column(name = "id", attrName = "id", label = "编号", isPK = true),
		@Column(name = "content", attrName = "content", label = "收支说明"),
		@Column(name = "adminid", attrName = "ztAdmin.id", label = "小程序用户id"),
		@Column(name = "status", attrName = "status", label = "状态"),
		@Column(name = "price", attrName = "price", label = "收支金额"),
		@Column(name = "goodsid", attrName = "ztGoods.id", label = "商品id"),
		@Column(name = "pricestr", attrName = "pricestr", label = "收支金额字符串"),
		@Column(name = "headimgurl", attrName = "headimgurl", label = "头像"),
		@Column(name = "username", attrName = "username", label = "微信名"),
		@Column(name = "type", attrName = "type", label = "状态  0待充值，1已充值，2已退还"),
		@Column(name = "create_date", attrName = "createDate", label = "创建时间"),
		@Column(name = "audit", attrName = "audit", label = "审核状态  0待审核，1已审核"),
		@Column(name = "phone", attrName = "phone", label = "手机号码"),
		@Column(name = "operation", attrName = "operation", label = "操作人"),
		@Column(name = "company_id", attrName = "companyId", label = "公司名称id"),
		@Column(name = "company_name", attrName = "companyName", label = "公司名称")

},joinTable = {
		@JoinTable(type = Type.LEFT_JOIN, entity = ZtAdmin.class, attrName = "ztAdmin", alias = "z", on = "z.id = a.adminid", columns = {
			@Column(name = "name", attrName = "name", label = "小程序名称", queryType = QueryType.LIKE),
			@Column(name = "headimgurl", label = "小程序头像", attrName = "headimgurl"), 
			@Column(name = "id", attrName = "id", label = "编号", isPK = true),

	}),
			
},orderBy = "a.create_date DESC")
public class ZtFinancial extends DataEntity<ZtFinancial> {

	private static final long serialVersionUID = 1L;
	private String content;
	private ZtAdmin ztAdmin;
	private String pricestr;
	private Double price;
	private String type;//1一级佣金  2二级佣金     3支出     4提现     
	private String status;
	
	private ZtGoods ztGoods;//商品id      //提现为空
	
	private String headimgurl="";
	private String username="";
	
	private Integer pageNum;


	private String companyId;
	private String companyName;
	private String audit;
	private String phone,operation;


	private Date createDate;
	@JsonIgnore
	private String updateBy;
	@JsonIgnore
	private String createBy;
	@JsonIgnore
	private Date updateDate;
	

	public ZtGoods getZtGoods() {
		return ztGoods;
	}
	public void setZtGoods(ZtGoods ztGoods) {
		this.ztGoods = ztGoods;
	}
	public String getHeadimgurl() {
		return headimgurl;
	}
	public void setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
	}
	@ExcelField(title="用户名称", attrName="username", align= ExcelField.Align.CENTER, sort=20)
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public Integer getPageNum() {
		return pageNum;
	}
	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}
	@JsonIgnore
	public ZtAdmin getZtAdmin() {
		return ztAdmin;
	}
	public void setZtAdmin(ZtAdmin ztAdmin) {
		this.ztAdmin = ztAdmin;
	}
	@ExcelField(title="明细", attrName="content", align= ExcelField.Align.CENTER, sort=50)
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}

	public String getPricestr() {
		return pricestr;
	}
	public void setPricestr(String pricestr) {
		this.pricestr = pricestr;
	}
	@ExcelField(title="金额", attrName="price", align= ExcelField.Align.CENTER, sort=40)
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	@JsonIgnore
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	@ExcelField(title="公司编号", attrName="companyId", align= ExcelField.Align.CENTER,type = ExcelField.Type.IMPORT, sort=10)
	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}
	@ExcelField(title="公司名称", attrName="companyName", align= ExcelField.Align.CENTER, sort=30)
	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getAudit() {
		return audit;
	}

	public void setAudit(String audit) {
		this.audit = audit;
	}
	@ExcelField(title="手机号码", attrName="phone", align= ExcelField.Align.CENTER, sort=60)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	@ExcelField(title="操作人", attrName="operation", align= ExcelField.Align.CENTER, sort=70)
	public String getOperation() {
		return operation;
	}

	public void setOperation(String operation) {
		this.operation = operation;
	}

	public void setCreateDate_gte(Date createDate){
		createDate = DateUtils.getOfDayFirst(createDate); // 将日期的时间改为0点0分0秒
		sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
	}

	public Date getCreateDate_lte(){
		return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
	}

	public void setCreateDate_lte(Date createDate){
		createDate = DateUtils.getOfDayLast(createDate); // 将日期的时间改为23点59分59秒
		sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
	}

}